3.3 \(\int \frac {\sin ^2(x)}{i+\cot (x)} \, dx\)

Optimal. Leaf size=50 \[ -\frac {3 i x}{8}-\frac {i}{8 (-\cot (x)+i)}+\frac {i}{4 (\cot (x)+i)}-\frac {1}{8 (\cot (x)+i)^2} \]

[Out]

-3/8*I*x-1/8*I/(I-cot(x))-1/8/(I+cot(x))^2+1/4*I/(I+cot(x))

________________________________________________________________________________________

Rubi [A]  time = 0.05, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3487, 44, 203} \[ -\frac {3 i x}{8}-\frac {i}{8 (-\cot (x)+i)}+\frac {i}{4 (\cot (x)+i)}-\frac {1}{8 (\cot (x)+i)^2} \]

Antiderivative was successfully verified.

[In]

Int[Sin[x]^2/(I + Cot[x]),x]

[Out]

((-3*I)/8)*x - (I/8)/(I - Cot[x]) - 1/(8*(I + Cot[x])^2) + (I/4)/(I + Cot[x])

Rule 44

Int[((a_) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*
x)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && L
tQ[m + n + 2, 0])

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 3487

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rubi steps

\begin {align*} \int \frac {\sin ^2(x)}{i+\cot (x)} \, dx &=-\operatorname {Subst}\left (\int \frac {1}{(i-x)^2 (i+x)^3} \, dx,x,\cot (x)\right )\\ &=-\operatorname {Subst}\left (\int \left (\frac {i}{8 (-i+x)^2}-\frac {1}{4 (i+x)^3}+\frac {i}{4 (i+x)^2}-\frac {3 i}{8 \left (1+x^2\right )}\right ) \, dx,x,\cot (x)\right )\\ &=-\frac {i}{8 (i-\cot (x))}-\frac {1}{8 (i+\cot (x))^2}+\frac {i}{4 (i+\cot (x))}+\frac {3}{8} i \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (x)\right )\\ &=-\frac {3 i x}{8}-\frac {i}{8 (i-\cot (x))}-\frac {1}{8 (i+\cot (x))^2}+\frac {i}{4 (i+\cot (x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.05, size = 36, normalized size = 0.72 \[ -\frac {1}{32} i (12 x-8 \sin (2 x)+\sin (4 x)-4 i \cos (2 x)+i \cos (4 x)) \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[x]^2/(I + Cot[x]),x]

[Out]

(-1/32*I)*(12*x - (4*I)*Cos[2*x] + I*Cos[4*x] - 8*Sin[2*x] + Sin[4*x])

________________________________________________________________________________________

fricas [A]  time = 0.47, size = 27, normalized size = 0.54 \[ \frac {1}{32} \, {\left (-12 i \, x e^{\left (4 i \, x\right )} + 2 \, e^{\left (6 i \, x\right )} - 6 \, e^{\left (2 i \, x\right )} + 1\right )} e^{\left (-4 i \, x\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/(I+cot(x)),x, algorithm="fricas")

[Out]

1/32*(-12*I*x*e^(4*I*x) + 2*e^(6*I*x) - 6*e^(2*I*x) + 1)*e^(-4*I*x)

________________________________________________________________________________________

giac [A]  time = 0.36, size = 51, normalized size = 1.02 \[ -\frac {-3 i \, \tan \relax (x) + 1}{16 \, {\left (-i \, \tan \relax (x) + 1\right )}} + \frac {9 \, \tan \relax (x)^{2} - 2 i \, \tan \relax (x) + 3}{32 \, {\left (\tan \relax (x) - i\right )}^{2}} + \frac {3}{16} \, \log \left (\tan \relax (x) + i\right ) - \frac {3}{16} \, \log \left (\tan \relax (x) - i\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/(I+cot(x)),x, algorithm="giac")

[Out]

-1/16*(-3*I*tan(x) + 1)/(-I*tan(x) + 1) + 1/32*(9*tan(x)^2 - 2*I*tan(x) + 3)/(tan(x) - I)^2 + 3/16*log(tan(x)
+ I) - 3/16*log(tan(x) - I)

________________________________________________________________________________________

maple [A]  time = 0.32, size = 47, normalized size = 0.94 \[ \frac {i}{8 i+8 \tan \relax (x )}+\frac {3 \ln \left (i+\tan \relax (x )\right )}{16}+\frac {i}{2 \tan \relax (x )-2 i}-\frac {1}{8 \left (\tan \relax (x )-i\right )^{2}}-\frac {3 \ln \left (\tan \relax (x )-i\right )}{16} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)^2/(I+cot(x)),x)

[Out]

1/8*I/(I+tan(x))+3/16*ln(I+tan(x))+1/2*I/(tan(x)-I)-1/8/(tan(x)-I)^2-3/16*ln(tan(x)-I)

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/(I+cot(x)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 0.25, size = 37, normalized size = 0.74 \[ -\frac {x\,3{}\mathrm {i}}{8}-\frac {\frac {{\mathrm {tan}\relax (x)}^2\,5{}\mathrm {i}}{8}+\frac {\mathrm {tan}\relax (x)}{8}+\frac {1}{4}{}\mathrm {i}}{\left (\mathrm {tan}\relax (x)+1{}\mathrm {i}\right )\,{\left (1+\mathrm {tan}\relax (x)\,1{}\mathrm {i}\right )}^2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)^2/(cot(x) + 1i),x)

[Out]

- (x*3i)/8 - (tan(x)/8 + (tan(x)^2*5i)/8 + 1i/4)/((tan(x) + 1i)*(tan(x)*1i + 1)^2)

________________________________________________________________________________________

sympy [A]  time = 0.14, size = 34, normalized size = 0.68 \[ - \frac {3 i x}{8} + \frac {e^{2 i x}}{16} - \frac {3 e^{- 2 i x}}{16} + \frac {e^{- 4 i x}}{32} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)**2/(I+cot(x)),x)

[Out]

-3*I*x/8 + exp(2*I*x)/16 - 3*exp(-2*I*x)/16 + exp(-4*I*x)/32

________________________________________________________________________________________